import mongoose from 'mongoose'
import config from './index'

//创建连接
mongoose.connect(config.DB_URL,{
    useNewUrlParser:true, 
    useUnifiedTopology: true 
})

//连接成功
mongoose.connection.on('connectd', ()=>{
    console.log('mongoose connection open to'+ config.DB_URL);
})

mongoose.connection.on('error', (err)=>{
    console.log('mongoose connection open to'+ err);
})


mongoose.connection.on('disconnectd', ()=>{
    console.log('mongoose connection disconnected');
})


export default mongoose
